<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <h3>姓名是：{{name}}</h3>
    <h3>年龄是：{{ age }} <span>title的值是：{{title}}</span> </h3>
    <h3>info.a的值是：{{info.a}}</h3>

    <div>name的值：<input type="text" v-model="name" /></div>
    <div>info.a的值：<input type="text" v-model="info.a" /></div>

  </div>
  <script src="../vue/index.js"></script>
  <script>



    function replaceTpl(template, obj) {
      return template.replace(/\{\{\s*(\S+)\s*\}\}/g, (node, k) => {
        return obj[k]
      })
    }


    let vm = new Vue({
      el: '#app',
      data() {
        return {
          name: 'zs',
          age: 20,
          info: {
            a: 'a1',
            c: 'c1'
          },

          title: '学生列表',
          classNum: 1,
          total: 2,
          teacher: ['张三', '李四'],

          students: [
            {
              id: 1,
              name: '小红'
            },
            {
              id: 2,
              name: '小明'
            }
          ]
        }
      }
    })

      ; console.log(vm)
    vm.students.splice(1, 1, {
      id: 3,
      name: '小白'
    })

    vm.students.push({
      id: 4,
      name: '哈哈'
    })

    vm.students.splice(0, 1);

    setTimeout(() => {
      vm.title = '刘'
    }, 3000)

  </script>

</body>

</html>